﻿using Ceremony.API.Model;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Ceremony.API.Infrastructure.EntityConfigurations
{
    public class AuthorizeEntityTypeConfiguration
        : IEntityTypeConfiguration<Authorize>
    {
        public void Configure(EntityTypeBuilder<Authorize> builder)
        {
            builder.ToTable("Authorize");

            builder.HasKey(ci => ci.Id);

            builder.Property(ci => ci.Id)
               .UseHiLo("authorize_hilo")
               .IsRequired();

            builder.Property(cb => cb.Code)
                .IsRequired()
                .HasMaxLength(100);
            builder.Property(cb => cb.IsEnable)
               .IsRequired();
        }
    }
}
